function [pdf,logpdf]=pdf_norms(x,mu,sig2); 
% [pdf,logpdf]=pdf_norms(x,mu,sig2); 
% 
% Compute the PDF and log-pdf of a 
% multivariate NORMAL for a single element
% Input can be a row or column vector 
% Must must have the same size 
% sig2 must be the variance, NOT the precision 
% AJ 5/17/04 
x=x(:); 
mu=mu(:); 
ns=size(sig2) ; 
if ns ~= length(x)*ones(1,2) 
    error('Check dimension of Var and Mean of the normal ') 
end 
isig=sig2 \ eye( ns(1) ); 
cons=( ns(1)/2)*log(2*pi);
dsig2=0.5*log(det(sig2)); 
expo=0.5*( (x-mu)' )*isig*(x-mu) ;
logpdf=-(cons+dsig2+expo); 
pdf=exp(logpdf); 